<?php

$i=1;
$merchandise_items = array();
foreach($this->merchandise as $merch_item)
{
	$code_name = "code$i";
	$desc_name = "desc$i";
	$pic_name = "pic$i";
	$rank_name = "rank$i";
	
	$merchandise_items[$code_name] = $merch_item["FDMS_product_code"];
	$merchandise_items[$desc_name] = $merch_item["description"];
	$merchandise_items[$pic_name] = $merch_item["picture_name"];	
	$merchandise_items[$rank_name] = $merch_item["rank"];	
	
	$i++;
}

$actionURL = $this->url(array('controller'=>'index','action'=>'ksedittopmerchandise'));
$form = new PriorityMerchandiseItemsForm();
$form->populate($merchandise_items);
$form->setAction($actionURL);
echo $form->render_with_template( "prioritymerchandisetable.xhtml" );

 ?>